<?
include_once('conn.php');
include_once('include/func.php');
include("admin_check.php") ;
if($admin[0][2]<>10){exit('<script>alert("您没有权限"); window.history.back(-1);</script>');}
?>	
<?
if($_POST[action]==1 or $_GET[action]==1){$key=27;}elseif($_POST[action]==2 or $_GET[action]==2){$key=28;}
elseif($_POST[action]==3 or $_GET[action]==3){$key=29;}elseif($_POST[action]==4 or $_GET[action]==4){$key=30;}elseif($_POST[action]==5 or $_GET[action]==5){$key=32;}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><? echo systemname;?></title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
	<!-- jquery packed -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script type="text/javascript" src="js/dtree.js"></script>
        	<script type="text/javascript" src="fck/ckeditor.js"></script>
	<script src="fck/fck.js" type="text/javascript"></script>
	<link href="fck/css.css" rel="stylesheet" type="text/css" />
	<!-- tableRowCheckboxToggle -->
	<script type="text/javascript" src="js/tableRowCheckboxToggle.js"></script>
    
    <script type="text/javascript"> 
function InsertHTML(picname)
{
	var picname;
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.editor1;
	var value = '<img src="msgbox/saved/'+picname+'" />';

	// Check the active editing mode.
	if ( oEditor.mode == 'wysiwyg' )
	{
		// Insert HTML code.
		// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#insertHtml
		oEditor.insertHtml( value );
	}
	else
		alert( 'You must be in WYSIWYG mode!' );
		
}

</script> 
<link href="css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/swfupload.js"></script>
<script type="text/javascript" src="js/handlers.js"></script>
<script type="text/javascript">
		var swfu;
		window.onload = function () {
			swfu = new SWFUpload({
				// Backend Settings
				upload_url: "include/upload.php",
				post_params: {"PHPSESSID": "<?php echo session_id(); ?>"},

				// File Upload Settings
				file_size_limit : "5 MB",
				file_types : "*.jpg;*.png",
				file_types_description : "JPG Images; PNG Image",
				file_upload_limit : 0,

				// Event Handler Settings - these functions as defined in Handlers.js
				//  The handlers are not part of SWFUpload but are part of my website and control how
				//  my website reacts to the SWFUpload events.
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,

				// Button Settings
				button_image_url : "images/SmallSpyGlassWithTransperancy_17x18.png",
				button_placeholder_id : "spanButtonPlaceholder",
				button_width: 250,
				button_height: 18,
				button_text : '<span class="button">上传图片<span class="buttonSmall">(每次最大上传限制5 MB)</span></span>',
				button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; width: 250px; } .buttonSmall { font-size: 10pt; }',
				button_text_top_padding: 0,
				button_text_left_padding: 18,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				
				// Flash Settings
				flash_url : "js/swfupload.swf",
				flash9_url : "js/swfupload_fp9.swf",

				custom_settings : {
					upload_target : "divFileProgressContainer",
					thumbnail_height: 400,
					thumbnail_width: 400,
					thumbnail_quality: 100
				},
				
				// Debug Settings
				debug: false
			});
		};
		
		
		
		
	</script>
</head>
<body><? if($_POST){
	
	$db->UPDATE("UPDATE `".tablepre."config` SET `value`='".$_POST[msg]."' WHERE (`id`='".$key."')");
	exit('<script>alert("成功");location=\'?action='.$_POST[action].'\';</script>');
	}
?>
<div id="wrap">
<div id="main" class="clearfix">
<div id="side">
  </div>
  <div id="head"><? include_once('admin_head.php');?></div>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="13%" valign="top"><div id="left"><?
  include_once('admin_menu.php');
  ?></div></td>
    <td width="87%" valign="top"><div id="right">
    <script type="text/javascript">
    $(document).ready(function(){
		$("#sub_menu li",this).mouseenter(function(){
			$(".sub_menu_sub",this).css("display","block");
			});
		$("#sub_menu li",this).mouseleave(function(){
			$(".sub_menu_sub",this).css("display","none");
			});
		});
    </script>
    <style>
    #sub_menu ul{ margin:0 0 9px 0; padding:0 0 9px 0;}
	#sub_menu li{ list-style-type:none; float:left; margin:0 9px 0 0; width:90px; text-align:center; padding:0; background-color: #333; color:#FFF; height:30px; line-height:30px;}
	#sub_menu li span{width:90px; height:30px;}
	#sub_menu ol{ margin:0; padding:0;}
	#sub_menu .sub_menu_sub{ position: relative; background-color:#FFF; border-bottom:#333 1px solid; border-top:#333 1px solid; width:90px; background-color:#EFEFEF; display:none; }
    </style>
    <div id="sub_menu">
    <ul>
      <li><a href="?action=1">帮助信息</a></li>
      <li><a href="?action=5">欢迎信息</a></li>
      <li><span><a href="javascript:void(0);">邮件信息</a></span>

<div class="sub_menu_sub">
      <ol><a href="?action=2">忘记密码</a></ol>
      </div> </li>
      <li><span><a href="javascript:void(0);">打印信息</a></span><div class="sub_menu_sub">
      <ol><a href="?action=3">客户订单</a></ol>
      <ol><a href="?action=4">管理员订单</a></ol>
      </div></li><div id="clear"></div><div id="clear"></div></ul></div>
      <div id="clear"></div><hr />
    <img src="images/ttfjpg.php?t=信息编辑&amp;bg=titlebg2.jpg&amp;z=18&amp;x=5&amp;y=22&amp;r=0&amp;b=0&amp;g=0"  />
   
<form id="form2" name="form2" method="post" action="">
<table width="800" border="0" cellspacing="2" cellpadding="2">    
  <tr >
      <td><input type="hidden" value="<? echo $_GET[action];?>" name="action" />
内容：<? if($_GET[action]==2){echo '代码 {[password]} 为密码，请插入至适当位置';}
elseif($_GET[action]==5){echo '代码 {[membername]} 为用户名、 {[companyname]} 为公司名，请插入至适当位置';}?><br />
 <textarea cols="80" id="editor1" name="msg" rows="20" ><? echo parameters($key);?></textarea>
  		<script type="text/javascript">
		//<![CDATA[

			// Replace the <textarea id="editor"> with an CKEditor
			// instance, using default configurations.
			CKEDITOR.replace( 'editor1',
				{
					toolbar :
					[
					['Source','DocProps','-','Save','NewPage','Preview','-','Templates'], 
['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'], 
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], 
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote'], 
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], 
['Link','Unlink','Anchor'], ['Style','FontFormat','FontName','FontSize'], 
['TextColor','BGColor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak']
					]
				});

		//]]>
		</script></td>
    </tr>

</table><style>
#thumbnails{ float:left;}
#thumbnails ul{ margin:0; padding:0;}
#thumbnails li{ list-style-type:none; float:left; border:#CCC 1px solid; margin:0 5px 0 0; padding:5px; text-align:center;}
#thumbnails li input{margin:0 0 5px 0; padding:0;}
#divFileProgressContainer {height: 70px; position:absolute; margin-left:300px;}
</style>
<div id="divFileProgressContainer"></div>
<input type="submit" name="button2" id="button2" value="提交" />
</form><br />

<form>

		<div style="width: 180px; height: 18px; border: solid 1px #7FAAFF; background-color: #C5D9FF; padding: 2px;">
			<span id="spanButtonPlaceholder"></span>
		</div>
	</form>

<hr /><?php
			// Read the files from the saved images folder
			$dir = new DirectoryIterator("msgbox\saved");
			foreach ($dir as $fileinfo) {
				if (!$fileinfo->isDot() && $fileinfo->isFile()) {
	$code .= '<li><div><input onclick="InsertHTML("'.$fileinfo->getFilename().'")" type="button" value="插入" /><input onclick="delete("'.$fileinfo->getFilename().'")" type="button" value="删除" /></div><img style="margin: 5px; vertical-align: middle; height: 100px;" src="msgbox/saved/'.$fileinfo->getFilename().'" /></li>';
			}
			}
		?>
	<div id="thumbnails"><ul>
    <iframe name="res" style="display:block;" src="include/loadpic.php" frameborder="0" scrolling="yes" height="250px" width="800px"></iframe> 
	</ul>
	</div><div id="clear"></div></div></td>
  </tr>
</table>

  
  
  </div>
  </div>

<div id="footer">
<?
include_once('fooder.php');
?>
</div>
</BODY>
</HTML>
